using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Pipe : MonoBehaviour
{
    public float minRange;
    public float maxRange;

    public float speed;
    // Start is called before the first frame update
    void Start()
    {
        this.Init();

        
    }

    float t = 0;


    public void Init()
    {
        float y = Random.Range(minRange, maxRange);
        this.transform.localPosition = new Vector3(99f, 297.5933f + y, 0);

    }




    // Update is called once per frame
    void Update()
    {
        this.transform.position += new Vector3(-speed, 0, 0)*Time.deltaTime;
        t += Time.deltaTime;
        if (t > 6)
        {
            t = 0;
            this.Init();
        }
    }
}
